<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h3>人的对象：fisrtname姓、lastName名、age年龄、fullName方法</h3>
    <h3>动态添加：address地址（属性），fullName2（）</h3>
    <script>
        var Person={
            fisrtName : "林",
            lastName : "天",
            age : 18,
            fullName1 : function(){
                console.log(this);//代表person对象
                // 函数里不能直接访问对象的属性,加this关键字
                return  this.fisrtName+this.lastName;
            },
            // fullName11 :()=>{
            //     console.log(this);//代表window对象
            //     return  this.fisrtName+this.lastName;
            // }
            }
         
         console.log(Person);
         console.log(Person.fisrtName);
         console.log(Person.fullName1());

        //  动态的添加
         Person.address = "废都西安";
         Person.fullName2= function(){
             return this.fisrtName+this.lastName+","+this.age;
         }
         Person.fullName22 = ()=>{
            //  console.log(this)
            return Person.fisrtName+Person.lastName+","+Person.age;
         }
         console.log(Person);
         console.log(Person.fullName2());
         console.log(Person.fullName22());

    </script>
</body>
</html>